"""
@Filename: /main
@Time: 2022/4/5 23:18
@Author: 陈哥
target_time:2023年金三银四
target_salary: 20K
@Describe: ...
多问,每行代码写出来都问问自己为什么要这么写!!!!!!
"""
import unittest
from time import sleep


def add(a, b):
    return a + b


class MyUnitTest(unittest.TestCase):  # 1.在TestCase的子类中编写测试用例
    # def setUp(self) -> None:  # 2.夹具,夹具名事固定的,是由父类决定的
    #     print("测试用例开始执行啦:", self.id())
    #
    # def tearDown(self) -> None:
    #     print("测试用例执行结束啦:", self.id())

    def test_add(self):
        a, b = 1, 2
        c = add(a, b)
        _c = a + b
        assert c == _c
        # sleep(3)

    def test_error(self):
        # sleep(3)
        1 / 0
        print("0不能做除数")

    def test_fail(self):
        # sleep(2)
        assert 1 == 2
        print("1!=2,断言失败")

    @unittest.skip
    def test_skip(self):
        1 / 0

    def test_kkk_88(self):
        print("通过-k参数来挑选用例")


# suite = unittest.TestSuite()  # 3.创建测试套件,指定执行的内容以及顺序
# suite.addTest(MyUnitTest("test_fail"))
# suite.addTest(MyUnitTest("test_skip"))
# suite.addTest(MyUnitTest("test_error"))
#
# runner = unittest.TextTestRunner()  # 4.文本报告的runner
# report = runner.run(suite)
#
# print("所有的测试完毕,测试报告是：")
# print(report, type(report))

if __name__ == '__main__':
    unittest.main()
